package com.xuecheng.content.convert;

import com.xuecheng.api.content.model.CourseBaseDTO;
import com.xuecheng.api.content.model.vo.CourseBaseVo;
import com.xuecheng.content.entity.CourseBase;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 课程基础信息转换器
 */
@Mapper
public interface CourseBaseConvert {

    CourseBaseConvert INSTANCE = Mappers.getMapper(CourseBaseConvert.class);

    @Mapping(source = "id",target = "courseBaseId")
    CourseBaseDTO courseBaseToDTO(CourseBase courseBase);

    @Mapping(source = "courseBaseId",target = "id")
    CourseBase courseBaseDtoToPo(CourseBaseDTO courseBaseDTO);


    CourseBaseDTO courseBaseVoToDTo(CourseBaseVo courseBaseVo);


    /**
     * 集合类型数据转换会依赖于单个对象转换的方法
     */
    List<CourseBaseDTO> courseBaseToDTOs(List<CourseBase> courseBases);
}
